#!/usr/bin/env node

const cp=require('child_process');
console.log(`I am father process:${process.pid}`);

process.on('message',(data)=>{
  console.log(`I have son id:${data}`);
});


let son=cp.fork('./11-ipc-child.js');
let dau=cp.fork('./11-ipc-child.js ');


//给子进程发消息

setTimeout(()=>{
  son.send('Good Good study');

},2000);

setTimeout(()=>{
  dau.send('天天向');
},2000);

setTimeout(()=>{
  son.kill('SIGINT');
  dau.kill('SIGINT');
},5000);

